-- This turns on checks for common mistakes that can save you a
-- lot of time debugging. It takes some processor time, so it's
-- a good idea to turn this off when you're ready to release your app.
STRICT = true

-- This turns on the debug console, which can be brought up at
-- any point by pressing the Tab key. From the console, you can
-- watch values and run any Lua statement. The console also appears
-- automatically if your app crashes. Finally, you can press
-- Control-Alt-R (Control-Option-R on a Mac) to instantly reload your
-- code from on disk. Just like STRICT, you'd want to turn this off
-- for release.
DEBUG = true

require 'zoetrope'
require 'player'
require 'stackflea'
require 'fleastack'

bg = love.graphics.newImage( 'background.PNG' );


the.app = App:new
{
	onRun = function (self)
		self:add(Tile:new{ image = 'background.png' })

		self.stackfleas = FleaStack:new()
		self.stackfleas:push(StackFlea:new({ x = 600, y = 600 - 48, direction = RIGHT}))
		self:add(self.stackfleas)

		self.player = Player:new({ x = 0, y = 600 - 48 })
		self:add(self.player)
	end,

	onUpdate = function (self)
		self.stackfleas:collide(self.player)
    end,

	clonePlayer = function (self)
		local sf = StackFlea:new({ x = self.player.x, y = self.player.y
								  , direction = self.player.direction })
		self.stackfleas:push(sf)

	end
}

